﻿using MesErreurs;
using Metier;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Gestion_commerciale
{
    public partial class Fvendeur : Form
    {
        public Fvendeur()
        {
            InitializeComponent();
            List<String> mesNumeros;
            try
            {
                // Lecture classique
                Vendeur unVend = new Vendeur();
                mesNumeros = unVend.LectureNoVendeur();
                foreach (String item in mesNumeros)
                {
                    cb_Vendeur.Items.Add(item);
                }
            }
            catch (MonException exception)
            {
                MessageBox.Show(exception.MessageApplication(), exception.Message);
            }
        }

        private void bt_Fermer_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void bt_Interroger_Click(object sender, EventArgs e)
        {
            string numVend;
            Vendeur unVend = new Vendeur();
            Vendeur unVendeurCherche;

            try
            {
                numVend = cb_Vendeur.Text;
                unVendeurCherche = unVend.RechercheUnVendeur(numVend);
                lb_Nom.Text = "Nom : " + unVendeurCherche.NomVendeur;
                lb_Prenom.Text = "Prénom : " + unVendeurCherche.PrenomVendeur;
                lb_Date.Text = "Date Embauche : " + unVendeurCherche.DateEmbauche;
                lb_Salaire.Text = "Salaire : " + unVendeurCherche.SalaireVendeur;
                lb_Ville.Text = "Ville : " + unVendeurCherche.VilleVendeur;
                lb_Commission.Text = "Commission : " + unVendeurCherche.Commission;
                lb_Chef.Text = "N° Chef : " + unVendeurCherche.NoVendeurChef;
            }
            catch (MonException exception)
            {
                MessageBox.Show(exception.MessageApplication(), exception.Message);
            }
        }

        private void btnFermer_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
